import {View, Linking, Text} from 'react-native';
import React, {Component} from 'react';
import {Image, Button} from '@rneui/themed';
import config from 'react-native-config';
import QRCode from 'react-native-qrcode-svg';

export default class About extends Component {
  render() {
    const nowDate = new Date();
    return (
      <View
        style={{
          alignItems: 'center',
          flexDirection: 'column',
          height: '100%',
          flex: 1,
        }}>
        <View
          style={{
            flex: 3,
            alignItems: 'center',
            justifyContent: 'center',
          }}>
          <Text style={{fontWeight: 'bold', color: '#2089dc', fontSize: 22}}>
            {config.PROJECT_NAME}
          </Text>
          <Text style={{color: 'gray'}}>version: {config.VERSION}</Text>
        </View>
        <View style={{flex: 4,alignItems: 'center'}}>
            <View style={{width:150}}>
                <QRCode
                    value={config.BARCODE}
                    size={150}
                />
            </View>
            <Button
                title={config.OFFICIAL_WEBSITE}
                type="clear"
                onPress={() => Linking.openURL(config.OFFICIAL_WEBSITE)}
                titleStyle={{fontWeight: '100'}}
            />
        </View>
        <View style={{flex: 2, justifyContent: 'center'}}>
          <Button
            title="有新版本更新"
            onPress={() => {}}
            buttonStyle={{
              backgroundColor: '#2089dc',
              borderRadius: 30,
            }}
          />
        </View>
        <View style={{flex: 1}}>
          <Text style={{fontSize: 12}}>
            {config.COPY_RIGHT.replace('${year}', nowDate.getFullYear())}
          </Text>
        </View>
      </View>
    );
  }
}
